package com.health.yb.web.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.health.yb.core.exception.CommonException;
import com.health.yb.web.bean.common.Response;
import com.health.yb.web.bean.entity.YbType;
import com.health.yb.web.mapper.YbTypeMapper;
import com.health.yb.web.service.YbTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author rjwang
 * @version 1.0
 * @date 2019/12/17 20:35
 */
@Service
@Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
public class YbTypeServiceImpl extends ServiceImpl<YbTypeMapper, YbType> implements YbTypeService {

    @Autowired
    YbTypeMapper ybTypeMapper;

    @Override
    public Response addType(String typeName) {
        YbType build = YbType.builder().typeName(typeName).build();
        ybTypeMapper.insert(build);
        return new Response().successWithMsg("添加成功");
    }
}
